package net.lab1024.sa.admin.module.business.erp.sao.controller;

import net.lab1024.sa.admin.module.business.erp.sao.domain.form.SiordAddForm;
import net.lab1024.sa.admin.module.business.erp.sao.domain.form.SiordQueryForm;
import net.lab1024.sa.admin.module.business.erp.sao.domain.form.SiordUpdateForm;
import net.lab1024.sa.admin.module.business.erp.sao.domain.vo.SiordVO;
import net.lab1024.sa.admin.module.business.erp.sao.service.SiordService;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 销售发货单 Controller
 *
 * @Author AKITA
 * @Date 2025-08-27 14:33:47
 * @Copyright AKITA
 */

@RestController
@Tag(name = "销售发货单")
public class SiordController {

    @Resource
    private SiordService siordService;

    @Operation(summary = "分页查询 @author AKITA")
    @PostMapping("/siord/queryPage")
    public ResponseDTO<PageResult<SiordVO>> queryPage(@RequestBody @Valid SiordQueryForm queryForm) {
        return ResponseDTO.ok(siordService.queryPage(queryForm));
    }

    @Operation(summary = "添加 @author AKITA")
    @PostMapping("/siord/add")
    public ResponseDTO<Long> add(@RequestBody @Valid SiordAddForm addForm) {
        return siordService.add(addForm);
    }

    @Operation(summary = "更新 @author AKITA")
    @PostMapping("/siord/update")
    public ResponseDTO<String> update(@RequestBody @Valid SiordUpdateForm updateForm) {
        return siordService.update(updateForm);
    }

    @Operation(summary = "批量删除 @author AKITA")
    @PostMapping("/siord/batchDelete")
    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
        return siordService.batchDelete(idList);
    }

    @Operation(summary = "单个删除 @author AKITA")
    @GetMapping("/siord/delete/{id}")
    public ResponseDTO<String> batchDelete(@PathVariable Long id) {
        return siordService.delete(id);
    }


    @Operation(summary = "单个查询 @author AKITA")
    @GetMapping("/siord/info/{docEntry}")
    public ResponseDTO<SiordVO> info(@PathVariable Long docEntry) {
        return siordService.info(docEntry);
    }

    @Operation(summary = "单个查询 @author AKITA")
    @GetMapping("/siord/infoUnexecute/{id}")
    public ResponseDTO<SiordVO> infoUnexecute(@PathVariable Long id) {
        return siordService.infoUnexecute(id);
    }




}
